python glob and bracket characters ('[]')

Posted by prosseek on Stack Overflow See other posts from Stack Overflow or by prosseek
Published on 2010-04-07T19:00:10Z Indexed on 2010/04/07 19:03 UTC
Read the original article Hit count: 419

Filed under:
|

/Users/smcho/Desktop/bracket/[10,20] directory has "abc.txt", but when I run this python code

import glob
import os.path

path1 = "/Users/smcho/Desktop/bracket/\[10,20\]"
pathName = os.path.join(path1, "*.txt")
print glob.glob(pathName)

It returns empty list.

  • Can't python's glob doesn't handle the bracket letters or others?
  • Is there any way to solve this problem?

© Stack Overflow or respective owner

Related posts about python

Related posts about glob